import { termStatusOptions, genderOptions, educationOptions, politicalStatusOptions, householdTypeOptions, disabilityTypeOptions, isConsentOutworkOptions, isGraduateOptions } from './attr'
import { getLabelByValue } from '@/utils/index'

// 学生管理 列表
export const studentColumns = [
  {
    title: '学生姓名',
    dataIndex: 'studentName',
    key: 'studentName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '学籍号',
    dataIndex: 'studentNumber',
    key: 'studentNumber',
    align: 'center'
  },
  {
    title: '性别',
    dataIndex: 'sex',
    key: 'sex',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, genderOptions)
  },
  {
    title: '民族',
    dataIndex: 'nation',
    key: 'nation',
    width: 'auto',
    align: 'center'
  },
  {
    title: '出生日期',
    dataIndex: 'birthday',
    key: 'birthday',
    width: 'auto',
    align: 'center'
  },
  {
    title: '所在乡镇',
    dataIndex: 'areaName',
    key: 'areaName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '班级',
    dataIndex: 'classes',
    key: 'classes',
    width: 'auto',
    align: 'center',
    render: (val, row) => {
      if (val) {
        return `${row.grade}年级${val}班`
      }
      return ''
    }
  },
  {
    title: '残疾类型',
    dataIndex: 'disabilityType',
    key: 'disabilityType',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, disabilityTypeOptions)
  },
  {
    title: '是否同意送教',
    dataIndex: 'isConsentOutwork',
    key: 'isConsentOutwork',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, isConsentOutworkOptions)
  },
  {
    title: '是否毕业',
    dataIndex: 'status',
    key: 'status',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, isGraduateOptions)
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    width: 'auto',
    align: 'center',
    isBtn: true
  }
]

// 学生管理 详情
export const studentDetailColumns = [
  {
    title: '学生ID',
    dataIndex: 'id',
    key: 'id'
  },
  {
    title: '学生姓名',
    dataIndex: 'studentName',
    key: 'studentName'
  },
  {
    title: '学籍号',
    key: 'studentNumber',
    dataIndex: 'studentNumber'
  },
  {
    title: '身份证号',
    key: 'idCardNumber',
    dataIndex: 'idCardNumber'
  },
  {
    title: '性别',
    dataIndex: 'sex',
    key: 'sex',
    render: val => getLabelByValue(val, genderOptions)
  },
  {
    title: '民族',
    dataIndex: 'nation',
    key: 'nation'
  },
  {
    title: '联系电话',
    dataIndex: 'mobile',
    key: 'mobile'
  },
  {
    title: '出生日期',
    dataIndex: 'birthday',
    key: 'birthday'
  },
  {
    title: '所在乡镇',
    dataIndex: 'areaName',
    key: 'areaName'
  },
  {
    title: '班级',
    dataIndex: 'classes',
    key: 'classes',
    render: (val, row) => {
      if (val) {
        return `${row.grade}年级${val}班`
      }
      return ''
    }
  },
  {
    title: '政治面貌',
    dataIndex: 'politicalStatus',
    key: 'politicalStatus',
    render: val => getLabelByValue(val, politicalStatusOptions)
  },
  {
    title: '户口性质',
    dataIndex: 'householdType',
    key: 'householdType',
    render: val => getLabelByValue(val, householdTypeOptions)
  },
  {
    title: '入学年月',
    dataIndex: 'enterSchoolTime',
    key: 'enterSchoolTime'
  },
  {
    title: '家庭住址',
    dataIndex: 'homeAddress',
    key: 'homeAddress'
  },
  {
    title: '班内学号',
    dataIndex: 'insideClassNo',
    key: 'insideClassNo'
  },
  {
    title: '学生来源',
    dataIndex: 'studentSource',
    key: 'studentSource'
  },
  {
    title: '残疾证号',
    dataIndex: 'disabilityCardNo',
    key: 'disabilityCardNo'
  },
  {
    title: '残疾类型',
    dataIndex: 'disabilityType',
    key: 'disabilityType',
    render: val => getLabelByValue(val, disabilityTypeOptions)
  },
  {
    title: '残疾等级',
    dataIndex: 'disabilityLevel',
    key: 'disabilityLevel'
  },
  {
    title: '家庭成员姓名',
    dataIndex: 'familyName',
    key: 'familyName'
  },
  {
    title: '家庭成员关系',
    dataIndex: 'familyRelation',
    key: 'familyRelation'
  },
  {
    title: '家庭成员联系电话',
    dataIndex: 'familyMobile',
    key: 'familyMobile'
  },
  {
    title: '是否毕业',
    dataIndex: 'status',
    key: 'status',
    render: val => getLabelByValue(val, isGraduateOptions)
  },
  {
    title: '是否同意送教',
    dataIndex: 'isConsentOutwork',
    key: 'isConsentOutwork',
    render: val => getLabelByValue(val, isConsentOutworkOptions)
  },
  {
    title: '家长同意书',
    dataIndex: 'familyConsentLetter',
    key: 'familyConsentLetter',
    isHidden: row => Number(row.isConsentOutwork) !== 1,
    hasSlot: true
  },
  {
    title: '家长不同意知情书',
    dataIndex: 'familyRefuseInformedLetter',
    key: 'familyRefuseInformedLetter',
    isHidden: row => Number(row.isConsentOutwork) !== 2,
    hasSlot: true
  },
  {
    title: '学生评估表',
    dataIndex: 'studentAssessTable',
    key: 'studentAssessTable',
    isHidden: row => Number(row.isConsentOutwork) === 0,
    hasSlot: true
  },
  {
    title: '备注',
    dataIndex: 'remark',
    key: 'remark'
  }
]

// 教师管理 列表
export const teacherColumns = [
  {
    title: '姓名',
    dataIndex: 'teacherName',
    key: 'teacherName'
  },
  {
    title: '性别',
    dataIndex: 'sex',
    key: 'sex',
    render: val => getLabelByValue(val, genderOptions)
  },
  {
    title: '学历',
    dataIndex: 'education',
    key: 'education',
    render: val => getLabelByValue(val, educationOptions)
  },
  {
    title: '所在学校',
    dataIndex: 'subSchoolName',
    key: 'subSchoolName'
  },
  {
    title: '单位负责人',
    dataIndex: 'unitLeader',
    key: 'unitLeader'
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    width: 'auto',
    align: 'center',
    isBtn: true
  }
]

// 教师管理 详情
export const teacherDetailColumns = [
  {
    title: '教师ID',
    dataIndex: 'id',
    key: 'id'
  },
  {
    title: '姓名',
    dataIndex: 'teacherName',
    key: 'teacherName'
  },
  {
    title: '性别',
    dataIndex: 'sex',
    key: 'sex',
    render: val => getLabelByValue(val, genderOptions)
  },
  {
    title: '身份证号',
    dataIndex: 'idCardNumber',
    key: 'idCardNumber'
  },
  {
    title: '学历',
    dataIndex: 'education',
    key: 'education',
    render: val => getLabelByValue(val, educationOptions)
  },
  {
    title: '所在学校',
    dataIndex: 'subSchoolName',
    key: 'subSchoolName'
  },
  {
    title: '联系方式',
    dataIndex: 'mobile',
    key: 'mobile'
  },
  {
    title: '单位负责人',
    dataIndex: 'unitLeader',
    key: 'unitLeader'
  },
  {
    title: '备注',
    dataIndex: 'remark',
    key: 'remark'
  }
]

// 学校管理 列表
export const schoolColumns = [
  {
    title: 'id',
    dataIndex: 'id',
    key: 'id'
  },
  {
    title: '学校名称',
    dataIndex: 'name',
    key: 'name'
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    width: 'auto',
    align: 'center',
    isBtn: true
  }
]

// 学期管理 列表
export const schoolYearColumns = [
  {
    title: '学期',
    dataIndex: 'name',
    key: 'name'
  },
  {
    title: '起止时间',
    dataIndex: 'termStart',
    key: 'termStart',
    render: (val, row) => `${val} - ${row.termEnd}`
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status',
    render: val => getLabelByValue(val, termStatusOptions)
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    width: 'auto',
    align: 'center',
    isBtn: true
  }
]

// 乡校管理 列表
export const xschoolColumns = [
  {
    title: 'id',
    dataIndex: 'id',
    key: 'id'
  },
  {
    title: '乡校名称',
    dataIndex: 'schoolName',
    key: 'schoolName'
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    width: 'auto',
    align: 'center',
    isBtn: true
  }
]
